import React from 'react'
// ===================================================================== Temp
import Table from '#cpt/temp/Table'
import TableControls from '#cpt/temp/TableControls'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== private component
const Box = $Lazy.load(()=>import('#tp/box/box'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data: []
	}

	// 表格
	cols=[
		{ title: '条码号', 	dataIndex: 'spec_code',			...$fn.table.spec_code,	 },
		{ title: '医院',	dataIndex: 'hosp_name',			width:200 },
		{ title: '姓名 ', 	dataIndex: 'patient_name',		...$fn.table.name,  },
		{ title: '性别 ', 	dataIndex: 'sex_name',			...$fn.table.sex,  },
		{ title: '科室 ',	dataIndex: 'department_name',	width:280,  },
		TableControls.controls.call(this,{ width: 100 })
	]

  // 表格按钮
	table_controls = (text, val) => {
		return [
			TableControls.click.call(this, '删除',  ()=>{
				const { data } = this.state
				let d = data.filter( i => i.uuid !== val.uuid)
				this.setState({
					data: d
				})
				let form = this.formRef.getName()
				this.detailsLog.setState({ data: d, form })
			}),
		]
	}

  render(){
	return (
      <>
		<Box title='批量条码' contentClassName='rel fv pt10 p'>
			{/* 表格 */}
			{ Table.call(this) }
		</Box>
	</>
    )
  }
}

export default Index